class PasswordForm < Pan::Component
  def initialize title
    @title = title
    @name = ""
    @password = ""
    @text = "this is a text area!"
  end

  def style 
    <<EOS
<style>
h1 {
  text-size: 10px;
}
</style>
EOS
  end

  def render_on(html)
    if @password == "42"
      html.heading("Welcome, #{@name}",1)
    else
      html.form {
        html.heading(@title)
        html.heading("Please login",3)
        html.input("type"=>"text","value"=>@name) {|val| @name = val}
        html.br
        html.input("type"=>"password","value"=>@password) {|val| @password = val}      
        html.br
        html.text_area("value"=>@text) {|val| @text = val}
        html.br
        html.tag("input","type"=>"submit")
      }
    end
  end
end
